import os,sys
import platform
import json

from getJsonSetting import *
flag = "win"
path = "/home/lrr/workspace/Cura/resources/definitions"

file1 = "fdmprinter.def.json"
file3 = "deltacomb_dc20.def.json"
file2 = "deltacomb_base.def.json"
file4 = 'my_deltacomb.json'
if platform.system() != "Linux":
   path = r"C:\Program Files\Ultimaker Cura 4.7\resources\definitions"
# df_js_file = json.load(open(os.path.join(path,file4),'r'))
df_js_file = json.load(open(file4,'r'))
# # print(df_js_file)
# # key [u'version', u'name', u'settings', u'metadata']
# for key ,data in df_js_file['overrides'].items():
#     print(key,data)

keys = df_js_file['overrides'].keys()
print(len(keys))
print(len(set(keys)))
default_et = EngineTest(os.path.join(path,file1),df_js_file['overrides'])

with open("test2.txt",'w') as f:
    for key, setting in default_et._settings.items():
            # print(key)
            # break
            f.write("{} {}\n".format(key,setting.getDefault()))
